//
//  RootTabBarViewController.m
//  享动
//
//  Created by 沈浩hh on 16/4/5.
//  Copyright © 2016年 HHUI. All rights reserved.
//

#import "RootTabBarViewController.h"
#import "ViewController.h"
#import "MusicViewController.h"
#import "RunViewController.h"
#import "MyRunViewController.h"
#import "MoreViewController.h"
 
@interface RootTabBarViewController ()<UITabBarControllerDelegate >

@property(nonatomic,strong)UIButton * StartButton;

@end

@implementation RootTabBarViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    
    self.StartButton = [UIButton buttonWithType:UIButtonTypeSystem];
    self.StartButton.frame = CGRectMake((KWIDTH-60)/2, 4.5, 60, 40);
    self.StartButton.backgroundColor = [UIColor colorWithRed:136/255.0 green:205/255.0 blue:85/255.0 alpha:1];
    [self.StartButton setTitle:@"Start" forState:UIControlStateNormal];
    
    [self.StartButton.layer setCornerRadius:5];
    [self.tabBar addSubview:_StartButton];
    
    // 第一个界面
    ViewController *rootVc = [[ViewController alloc]init];
    
    UINavigationController *rootNav = [[UINavigationController alloc]initWithRootViewController:rootVc];
    rootNav.tabBarItem.title = @"享动乐";
    rootNav.tabBarItem.image = [UIImage imageNamed:@"102-walk"];
    
    // 第二个界面
    MusicViewController * music = [[MusicViewController shareInstence]initWithNibName:@"musicRun" bundle:[NSBundle mainBundle]];
    
    UINavigationController * musicNav = [[UINavigationController alloc]initWithRootViewController:music];
    musicNav.tabBarItem.title = @"享动悦";
    musicNav.tabBarItem.image = [UIImage imageNamed:@"65-note"];
    
    // 第三个界面
    RunViewController * run = [[RunViewController alloc]init];
    UINavigationController * runNav = [[UINavigationController alloc]initWithRootViewController:run];
    
    // 第四个界面    
    MyRunViewController * myRun = [[MyRunViewController alloc]init];
    UINavigationController * myrunNav = [[UINavigationController alloc]initWithRootViewController:myRun];
    myrunNav.tabBarItem.title = @"享动录";
    myrunNav.tabBarItem.image = [UIImage imageNamed:@"63-runner"];
    
    // 第五个界面
    MoreViewController * more = [[MoreViewController alloc]init];
    UINavigationController * moreNav = [[UINavigationController alloc]initWithRootViewController:more];
    moreNav.tabBarItem.title = @"更多";
    moreNav.tabBarItem.image = [UIImage imageNamed:@"19-gear"];
    more.navigationItem.title = @"账号";
    
    
    self.viewControllers = @[rootNav,musicNav,runNav,myrunNav,moreNav];
    
    self.delegate = self;
    
    
   [[UINavigationBar appearance]setBarTintColor:[UIColor colorWithRed:128/255.0 green:197/255.0 blue:56/255.0 alpha:1]];
    [[UINavigationBar appearance]setTintColor:[UIColor whiteColor]];
    [[UINavigationBar appearance]setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor whiteColor]}];

}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
